Skip to content

Add timber move to relocate a worktree checkout - #117

Merged
nnutter merged 1 commit into
masterfrom
move-worktree
Nov 10, 2026
Merged

nnutter merged 1 commit into
masterfrom
move-worktree

Conversation

@nnutter

@nnutter nnutter commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • New timber move <name[@repo]> <path> command (alias mv) that relocates a worktree checkout via git worktree move
  • Validates the destination (must not exist, must not be inside the worktree) and resolves relative paths against the cwd
  • Preserves the worktree's selector name by writing the timber-name file when the destination leaves the standard managed layout, so list/switch/prune keep working under the same name; manually linked worktrees re-derive from the new basename
  • Reports the relocated cwd through the path file and adds a move|mv case to the generated zsh wrapper so t move follows your shell into the new location
  • Shell completion: worktree names for arg 1, directory completion for arg 2

Test plan

  • go test ./internal/... — all pass, including new functional tests for relocation, name preservation, cwd path-file reporting, destination rejection, and the zsh wrapper cd behavior
  • hk pre-commit hooks (constable, staticcheck, nilaway, gosec, errcheck, testifylint, gofumpt, goimports, mdlint, gitleaks, govulncheck) all pass
  • Manual smoke test: created a worktree, moved it outside the worktree root, verified list --json shows the new path with the original name

Generated with Devin

Worktrees can already live outside the managed layout via custom create
paths and manual git worktree links, but there was no way to move an
existing checkout once created. `timber move <name[@repo]> <path>` runs
`git worktree move`, keeps the worktree's selector name by recording it
in the checkout's git dir when the destination leaves the standard
layout, and reports the relocated cwd through the path file so the zsh
wrapper can follow the shell into the new location.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Change-Id: I0e2c1e05d2ccb0ab2a076e65d7185a20fd54476c
@nnutter
nnutter merged commit e756a35 into master Nov 10, 2026
3 checks passed
@nnutter
nnutter deleted the move-worktree branch November 10, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant